<?php
  /**
   * Kontrollbase
   *
   * An open source MySQL monitoring and analytics application
   *
   * @package Kontrollbase
   * @author Matt Reid
   * @copyright Copyright (c) 2009 Matt Reid, Kontrollbase LLC
   * @license http://kontrollsoft.com/kontrollbase/userguide/general-LICENSE.php
   * @link http://kontrollbase.com
   */

$g['root'] = $root;
$nroot = substr_replace($root,"",-1); //remove the trailing slash from the root path

  print<<<HEAD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>KontrollKommand</title>

<link rel="stylesheet" type="text/css" href="$nroot/includes/style.css" />
<link rel="stylesheet" type="text/css" media="all" href="$nroot/userguide/css/userguide-nofluff.css" />
<link rel="stylesheet" type="text/css" href="$nroot/includes/extjs/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="$nroot/includes/extjs/resources/css/xtheme-slate.css" />
<link rel="stylesheet" type="text/css" href="$nroot/includes/tasks.css" />

<script type="text/javascript" src="$nroot/includes/browser_detect.js"></script>
<script type="text/javascript" src="$nroot/includes/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="$nroot/includes/extjs/ext-all.js"></script>
<script type="text/javascript" src="$nroot/includes/extjs/miframe.js"></script>

<script type="text/javascript">
    Ext.onReady(function() {  
		  Ext.QuickTips.init();
HEAD;
  
 $i = 1; 
 print "    
var serverList = [";
 $r=0;
 $u=count($data);
 
 foreach($data as $key => $value) {
   foreach($value as $k => $v) {
     $$k = $v;
   }     
   print "['$host_list_hostname','$host_list_uuid','$creation_time']\n";
   $r++;
   if($r<$u) { print ",\n";} 
   else { 
     print "];\n\n";
     
   }
 }
 print<<<HEAD
   
   var dataGrid = {
   title: '',
   xtype: 'grid',
   layout: 'fit',
   region:'center',
   tbar: [
   {
     text: 'Refresh',
     icon: '$nroot/includes/extjs/resources/images/slate/button/table_refresh.png',
     cls: 'x-btn-text-icon',
     handler: function() {
       window.location = '$nroot/index.php/agent/report';},
     scope: this,
   }
],
   store: new Ext.data.SimpleStore({
     fields: [
	      {name: 'host_list_hostname'},
	      {name: 'host_list_uuid'},
	      {name: 'creation_time'}
	      ]}),
   columns: [
	     
   { id:'host_list_hostname', header: "Hostname", width: 200, sortable: true, dataIndex: 'host_list_hostname' },
   { id:'host_list_uuid', header: "UUID", width: 250, sortable: true, dataIndex: 'host_list_uuid' },
   { id:'creation_time', header: "Access Time", width: 120, sortable: true, dataIndex: 'creation_time' },
   ],
   stripeRows: true,
   autoExpandColumn: 'host_list_hostname',
   listeners: {
     render: function(){
       this.store.loadData(serverList);
     }
   }
 };
 
 new Ext.Viewport({
   layout: 'border',
       title: 'grid',
       items: [ dataGrid ],
       renderTo: Ext.getBody()
       });
		});

</script>
</head>
<body>
</body>
</html>
HEAD;





?>